import { Body, Controller, Get, Post } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { NoteService } from './note.service';
import { Note } from './entities/note.entity';
import { CreateNoteDto } from './dto/create-note.dto';
@ApiTags('笔记模块')
@Controller('note')
export class NoteController {
  constructor(private readonly noteService: NoteService) {}
  // 获取笔记列表
  @ApiResponse({ status: 200, description: '返回笔记列表', type: [Note] })
  @ApiOperation({ summary: '获取笔记列表' })
  @Get('/list')
  async getNoteList() {
    return await this.noteService.getNoteList();
  }
  // 获取标签list
  @ApiResponse({ status: 200, description: '返回标签列表', type: [String] })
  @ApiOperation({ summary: '获取标签列表' })
  @Get('/tag/list')
  async getTagList() {
    return await this.noteService.getTagList();
  }
  // 创建笔记
  @ApiOperation({ summary: '创建笔记' })
  @Post('/create')
  async createNote(@Body() createNoteDto: CreateNoteDto) {
    return await this.noteService.createNote(createNoteDto);
  }
}
